﻿Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient

Public Class frmTheoDoiThaoTacUser
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents BtnClose As System.Windows.Forms.Button
    Friend WithEvents DataGridView1 As System.Windows.Forms.DataGridView
    Friend WithEvents GhichuDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents UserDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents ThaotacDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents ThoigianDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TenbangDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents MaphieuDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents LoaibangDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents IDDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TbltheodoithaotacusersBindingSource As System.Windows.Forms.BindingSource
    Friend WithEvents DataSetForm_Don As MEKONG.DataSetForm_Don
    Friend WithEvents btnRefresh As System.Windows.Forms.Button
    Friend WithEvents txtUser As System.Windows.Forms.TextBox
    Friend WithEvents txtTenBang As System.Windows.Forms.TextBox
    Friend WithEvents txtMaPhieu As System.Windows.Forms.TextBox
    Friend WithEvents dtpTuNgay As System.Windows.Forms.DateTimePicker
    Friend WithEvents dtpDenNgay As System.Windows.Forms.DateTimePicker
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents btnTimKiem As System.Windows.Forms.Button
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents MatinhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmTheoDoiThaoTacUser))
        Me.Label1 = New System.Windows.Forms.Label
        Me.BtnClose = New System.Windows.Forms.Button
        Me.DataGridView1 = New System.Windows.Forms.DataGridView
        Me.UserDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.ThaotacDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.ThoigianDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.TenbangDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.MaphieuDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.LoaibangDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.IDDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.TbltheodoithaotacusersBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.DataSetForm_Don = New MEKONG.DataSetForm_Don
        Me.btnRefresh = New System.Windows.Forms.Button
        Me.txtUser = New System.Windows.Forms.TextBox
        Me.txtTenBang = New System.Windows.Forms.TextBox
        Me.txtMaPhieu = New System.Windows.Forms.TextBox
        Me.dtpTuNgay = New System.Windows.Forms.DateTimePicker
        Me.dtpDenNgay = New System.Windows.Forms.DateTimePicker
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label5 = New System.Windows.Forms.Label
        Me.btnTimKiem = New System.Windows.Forms.Button
        Me.Label6 = New System.Windows.Forms.Label
        CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.TbltheodoithaotacusersBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.DataSetForm_Don, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(269, 3)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(339, 24)
        Me.Label1.TabIndex = 11
        Me.Label1.Text = "THEO DÕI THAO TÁC USER"
        '
        'BtnClose
        '
        Me.BtnClose.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.BtnClose.Location = New System.Drawing.Point(471, 87)
        Me.BtnClose.Name = "BtnClose"
        Me.BtnClose.Size = New System.Drawing.Size(81, 22)
        Me.BtnClose.TabIndex = 30
        Me.BtnClose.Text = "Thoát"
        '
        'DataGridView1
        '
        Me.DataGridView1.AllowUserToAddRows = False
        Me.DataGridView1.AllowUserToDeleteRows = False
        Me.DataGridView1.AllowUserToResizeColumns = False
        Me.DataGridView1.AutoGenerateColumns = False
        Me.DataGridView1.BackgroundColor = System.Drawing.Color.LightBlue
        Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
        Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.UserDataGridViewTextBoxColumn, Me.ThaotacDataGridViewTextBoxColumn, Me.ThoigianDataGridViewTextBoxColumn, Me.TenbangDataGridViewTextBoxColumn, Me.MaphieuDataGridViewTextBoxColumn, Me.LoaibangDataGridViewTextBoxColumn, Me.IDDataGridViewTextBoxColumn})
        Me.DataGridView1.DataSource = Me.TbltheodoithaotacusersBindingSource
        Me.DataGridView1.Location = New System.Drawing.Point(-1, 115)
        Me.DataGridView1.Name = "DataGridView1"
        Me.DataGridView1.ReadOnly = True
        Me.DataGridView1.Size = New System.Drawing.Size(885, 459)
        Me.DataGridView1.TabIndex = 48
        '
        'UserDataGridViewTextBoxColumn
        '
        Me.UserDataGridViewTextBoxColumn.DataPropertyName = "user"
        Me.UserDataGridViewTextBoxColumn.HeaderText = "user"
        Me.UserDataGridViewTextBoxColumn.Name = "UserDataGridViewTextBoxColumn"
        Me.UserDataGridViewTextBoxColumn.ReadOnly = True
        '
        'ThaotacDataGridViewTextBoxColumn
        '
        Me.ThaotacDataGridViewTextBoxColumn.DataPropertyName = "thaotac"
        Me.ThaotacDataGridViewTextBoxColumn.HeaderText = "Thao tác"
        Me.ThaotacDataGridViewTextBoxColumn.Name = "ThaotacDataGridViewTextBoxColumn"
        Me.ThaotacDataGridViewTextBoxColumn.ReadOnly = True
        '
        'ThoigianDataGridViewTextBoxColumn
        '
        Me.ThoigianDataGridViewTextBoxColumn.DataPropertyName = "thoigian"
        Me.ThoigianDataGridViewTextBoxColumn.HeaderText = "Thời gian"
        Me.ThoigianDataGridViewTextBoxColumn.Name = "ThoigianDataGridViewTextBoxColumn"
        Me.ThoigianDataGridViewTextBoxColumn.ReadOnly = True
        Me.ThoigianDataGridViewTextBoxColumn.Width = 150
        '
        'TenbangDataGridViewTextBoxColumn
        '
        Me.TenbangDataGridViewTextBoxColumn.DataPropertyName = "tenbang"
        Me.TenbangDataGridViewTextBoxColumn.HeaderText = "Tên bảng"
        Me.TenbangDataGridViewTextBoxColumn.Name = "TenbangDataGridViewTextBoxColumn"
        Me.TenbangDataGridViewTextBoxColumn.ReadOnly = True
        Me.TenbangDataGridViewTextBoxColumn.Width = 200
        '
        'MaphieuDataGridViewTextBoxColumn
        '
        Me.MaphieuDataGridViewTextBoxColumn.DataPropertyName = "maphieu"
        Me.MaphieuDataGridViewTextBoxColumn.HeaderText = "Mã phiếu"
        Me.MaphieuDataGridViewTextBoxColumn.Name = "MaphieuDataGridViewTextBoxColumn"
        Me.MaphieuDataGridViewTextBoxColumn.ReadOnly = True
        Me.MaphieuDataGridViewTextBoxColumn.Width = 150
        '
        'LoaibangDataGridViewTextBoxColumn
        '
        Me.LoaibangDataGridViewTextBoxColumn.DataPropertyName = "loaibang"
        Me.LoaibangDataGridViewTextBoxColumn.HeaderText = "loaibang"
        Me.LoaibangDataGridViewTextBoxColumn.Name = "LoaibangDataGridViewTextBoxColumn"
        Me.LoaibangDataGridViewTextBoxColumn.ReadOnly = True
        Me.LoaibangDataGridViewTextBoxColumn.Visible = False
        '
        'IDDataGridViewTextBoxColumn
        '
        Me.IDDataGridViewTextBoxColumn.DataPropertyName = "ID"
        Me.IDDataGridViewTextBoxColumn.HeaderText = "ID"
        Me.IDDataGridViewTextBoxColumn.Name = "IDDataGridViewTextBoxColumn"
        Me.IDDataGridViewTextBoxColumn.ReadOnly = True
        Me.IDDataGridViewTextBoxColumn.Visible = False
        '
        'TbltheodoithaotacusersBindingSource
        '
        Me.TbltheodoithaotacusersBindingSource.DataMember = "tbl_theodoi_thaotac_users"
        Me.TbltheodoithaotacusersBindingSource.DataSource = Me.DataSetForm_Don
        '
        'DataSetForm_Don
        '
        Me.DataSetForm_Don.DataSetName = "DataSetForm_Don"
        Me.DataSetForm_Don.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
        '
        'btnRefresh
        '
        Me.btnRefresh.Location = New System.Drawing.Point(366, 87)
        Me.btnRefresh.Name = "btnRefresh"
        Me.btnRefresh.Size = New System.Drawing.Size(81, 22)
        Me.btnRefresh.TabIndex = 49
        Me.btnRefresh.Text = "Refresh"
        Me.btnRefresh.UseVisualStyleBackColor = True
        '
        'txtUser
        '
        Me.txtUser.Location = New System.Drawing.Point(144, 59)
        Me.txtUser.Name = "txtUser"
        Me.txtUser.Size = New System.Drawing.Size(154, 20)
        Me.txtUser.TabIndex = 50
        '
        'txtTenBang
        '
        Me.txtTenBang.Location = New System.Drawing.Point(593, 59)
        Me.txtTenBang.Name = "txtTenBang"
        Me.txtTenBang.Size = New System.Drawing.Size(281, 20)
        Me.txtTenBang.TabIndex = 51
        '
        'txtMaPhieu
        '
        Me.txtMaPhieu.Location = New System.Drawing.Point(353, 59)
        Me.txtMaPhieu.Name = "txtMaPhieu"
        Me.txtMaPhieu.Size = New System.Drawing.Size(177, 20)
        Me.txtMaPhieu.TabIndex = 52
        '
        'dtpTuNgay
        '
        Me.dtpTuNgay.CustomFormat = "dd/MM/yyyy"
        Me.dtpTuNgay.Format = System.Windows.Forms.DateTimePickerFormat.Custom
        Me.dtpTuNgay.Location = New System.Drawing.Point(329, 32)
        Me.dtpTuNgay.Name = "dtpTuNgay"
        Me.dtpTuNgay.Size = New System.Drawing.Size(94, 20)
        Me.dtpTuNgay.TabIndex = 53
        '
        'dtpDenNgay
        '
        Me.dtpDenNgay.CustomFormat = "dd/MM/yyyy"
        Me.dtpDenNgay.Format = System.Windows.Forms.DateTimePickerFormat.Custom
        Me.dtpDenNgay.Location = New System.Drawing.Point(487, 32)
        Me.dtpDenNgay.Name = "dtpDenNgay"
        Me.dtpDenNgay.Size = New System.Drawing.Size(81, 20)
        Me.dtpDenNgay.TabIndex = 54
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(109, 63)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(29, 13)
        Me.Label2.TabIndex = 55
        Me.Label2.Text = "User"
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Location = New System.Drawing.Point(534, 63)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(53, 13)
        Me.Label3.TabIndex = 56
        Me.Label3.Text = "Tên bảng"
        '
        'Label4
        '
        Me.Label4.AutoSize = True
        Me.Label4.Location = New System.Drawing.Point(297, 63)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(51, 13)
        Me.Label4.TabIndex = 57
        Me.Label4.Text = "Mã phiếu"
        '
        'Label5
        '
        Me.Label5.AutoSize = True
        Me.Label5.Location = New System.Drawing.Point(278, 36)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(46, 13)
        Me.Label5.TabIndex = 58
        Me.Label5.Text = "Từ ngày"
        '
        'btnTimKiem
        '
        Me.btnTimKiem.Location = New System.Drawing.Point(274, 87)
        Me.btnTimKiem.Name = "btnTimKiem"
        Me.btnTimKiem.Size = New System.Drawing.Size(81, 22)
        Me.btnTimKiem.TabIndex = 59
        Me.btnTimKiem.Text = "Tìm Kiếm"
        Me.btnTimKiem.UseVisualStyleBackColor = True
        '
        'Label6
        '
        Me.Label6.AutoSize = True
        Me.Label6.Location = New System.Drawing.Point(429, 35)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(52, 13)
        Me.Label6.TabIndex = 60
        Me.Label6.Text = "đến ngày"
        '
        'frmTheoDoiThaoTacUser
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.Color.LightBlue
        Me.ClientSize = New System.Drawing.Size(886, 573)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.btnTimKiem)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.dtpDenNgay)
        Me.Controls.Add(Me.dtpTuNgay)
        Me.Controls.Add(Me.txtMaPhieu)
        Me.Controls.Add(Me.txtTenBang)
        Me.Controls.Add(Me.txtUser)
        Me.Controls.Add(Me.btnRefresh)
        Me.Controls.Add(Me.DataGridView1)
        Me.Controls.Add(Me.BtnClose)
        Me.Controls.Add(Me.Label1)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmTheoDoiThaoTacUser"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Theo doi thao tac users"
        CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.TbltheodoithaotacusersBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.DataSetForm_Don, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region
    Private sqlQuery As String = ""
    Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
        Me.Cursor = Cursors.WaitCursor
        sqlQuery = "SELECT * FROM tbl_theodoi_thaotac_users "
        Me.DataGridView1.DataSource = moduleDatabaseConn.GetDataTable(sqlQuery)
        Me.Cursor = Cursors.Default
    End Sub

    Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click
        Me.Close()
    End Sub

    Private Sub frmTheoDoiThaoTacUser_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.dtpTuNgay.Value = New Date(Now().Year, Now().Month, 1)
    End Sub

    Private Sub btnTimKiem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimKiem.Click
        Me.Cursor = Cursors.WaitCursor
        Dim sqlQuery As String
        sqlQuery = "SELECT *  FROM tbl_theodoi_thaotac_users where thoigian between '" & Format(Me.dtpTuNgay.Value, "yyyy-MM-dd") & "' AND '" & Format(Me.dtpDenNgay.Value, "yyyy-MM-dd") & "' "
        If Me.txtUser.TextLength > 0 Then
            sqlQuery += " AND  user = '" & Me.txtUser.Text & "' "
        End If
        If Me.txtTenBang.TextLength > 0 Then
            sqlQuery += " AND  tenbang = '" & Me.txtTenBang.Text & "' "
        End If
        If Me.txtMaPhieu.TextLength > 0 Then
            sqlQuery += " AND  maphieu = '" & Me.txtMaPhieu.Text & "' "
        End If
        Me.DataGridView1.DataSource = moduleDatabaseConn.GetDataTable(sqlQuery)
        Me.Cursor = Cursors.Default
    End Sub
End Class
